<%@page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
<link type="text/css" rel="stylesheet" href="${ctx }/css/dlifestyle/sectionparent.css" />
<link type="text/css" rel="stylesheet" href="${ctx }/css/dlifestyle/admin.css" />
<link type="text/css" rel="stylesheet" href="${ctx }/css/dlifestyle/new-add-goods.css" source="widget" />
<script src="${ctx}/js/controllers/base/shopinfo/ShopInfoDetailController.js" type="text/javascript"></script>
<section>
    <div style="height: 40px; line-height: 40px;">
        <div class="forword_area"></div>
        <div class="location">当前位置： ${sessionScope.currcent_position}</div>
    </div>
    <hr>
    <div class="panel panel-default" style="height: auto">
        <div class="editTitle">
            <div style="height: 41px; width: 190px; float: left;">
                <img style="float: left; margin-left: 37px; margin-top: 9.5px;" src="/manage/images/new_edit.png">
                <h4>商品详细信息</h4>
            </div>
            <div>
                <a style="float: right; margin-right: 20px; margin-top: -2px;" title="关闭" onclick="cancel();"><img src="${ctx}/images/new_close.png" /></a>
            </div>
        </div>
        <div id="replyList" class="right" style="height: auto; margin-top: -10px;">
            <div class="modal-header">
                <div id="form" class="form" style="min-height: 50px; margin-top: 10px; border-top: 1px solid #edeef3; font-size: 14px;">
                    <div class="itemEdit" style="border-bottom: 1px solid #CBD5DD; height: 110px;">
                        <input id="type" type="hidden" value="${goodsType}">
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px; height: 110px;">封面图片：</span>
                            <c:if test="${goodsInfo.logo == null || goodsInfo.logo == ''}">
                                <img id="preview3" style="margin-left:50px;width: 70px; height: 70px; float: left; margin-top: 10px;" title="快上传封面图片吧" src="${ctx}/images/common/defaultgoods.jpg" />
                            </c:if>
                            <c:if test="${goodsInfo.logo != null && goodsInfo.logo != ''}">
                                <img id="preview3" style="margin-left:50px;width: 70px; height: 70px; float: left; margin-top: 10px;" src="${sessionScope.image_logo}${goodsInfo.logo}" />
                            </c:if>
                    </div>
                    <div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px;">一级分类：</span>
                        <div class="fldetail-4l">
                            <select id="firstCategory" style="height: 25px; line-height: 25px; width: 197px; font-size: 12px;" disabled="disabled">
                                <option value="">--一级分类--</option>
                                <c:forEach items="${firstCategory}" var="firstItem" varStatus="status">
                                    <c:if test="${firstItem.id == goodsCategory.parentId}">
                                        <option id="${firstItem.name}" value="${firstItem.id}" selected>${firstItem.name}</option>
                                    </c:if>
                                    <c:if test="${firstItem.id != goodsCategory.parentId}">
                                        <option id="${firstItem.name}" value="${firstItem.id}">${firstItem.name}</option>
                                    </c:if>
                                </c:forEach>
                            </select>
                        </div>
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px;">二级分类：</span>
                        <div class="fldetail-4r">
                            <select id="secondCategory" style="height: 25px; line-height: 25px; width: 197px; font-size: 12px;" disabled="disabled">
                                <option value="">--二级分类--</option>
                                <c:if test="${not empty secondCategory}">
                                    <c:forEach items="${secondCategory}" var="secondItem" varStatus="status">
                                        <c:if test="${secondItem.id == goodsInfo.goodsCategoryId}">
                                            <option id="${secondItem.name}" value="${secondItem.id}" selected>${secondItem.name}</option>
                                        </c:if>
                                        <c:if test="${secondItem.id != goodsInfo.goodsCategoryId}">
                                            <option id="${secondItem.name}" value="${secondItem.id}">${secondItem.name}</option>
                                        </c:if>
                                    </c:forEach>
                                </c:if>
                            </select>
                        </div>
                    </div>
                    <div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px;">库存量：</span>
                        <div class="fldetail-4l">${goodsInfo.stock}</div>
                        <c:if test="${goodsType == 1}">
                            <span class="col-sm-1 editlableDetail" style="font-size: 14px;">商品价格：</span>
                            <div class="fldetail-4r">${goodsInfo.price}</div>
                        </c:if>
                        <c:if test="${goodsType == 2}">
                            <span class="col-sm-1 editlableDetail" style="font-size: 14px;">兑换积分：</span>
                            <div class="fldetail-4r">${goodsInfo.integralNum }</div>
                        </c:if>
                        <c:if test="${goodsType == 3}">
                            <span class="col-sm-1 editlableDetail" style="font-size: 14px;">商品价格：</span>
                            <div class="fldetail-4r">${goodsInfo.price }</div>
                        </c:if>
                    </div>
                    <div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px;">市场价：</span>
                        <div class="fldetail-4l">${goodsInfo.marketPrice}</div>
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px;">单位：</span>
                        <div class="fldetail-4r">${goodsInfo.unit}</div>
                    </div>
                    <div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px;">关键字：</span>
                        <div class="fldetail-4l">${goodsInfo.keyword}</div>
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px;">推荐等级：</span>
                        <div class="fldetail-4r">${goodsInfo.isRecommend == null ? 1 : goodsInfo.isRecommend}</div>
                    </div>
                    <c:if test="${goodsType == 3}">
                        <div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
                            <span class="col-sm-1 editlableDetail">秒杀开始时间：</span>
                            <div class="fldetail-4l">${goodsInfo.secKillStarttime.substring(0,19)}</div>
                            <span class="col-sm-1 editlableDetail">秒杀结束时间：</span>
                            <div class="fldetail-4r">${goodsInfo.secKillEndtime.substring(0,19)}</div>
                        </div>
                    </c:if>
                    <div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px;">排序：</span>
                        <div class="fldetail-4l">${goodsInfo.sort == null ? 1 : goodsInfo.sort}</div>
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px;">商品名称</span>
                        <div class="fldetail-4r">${goodsInfo.name}</div>
                    </div>
                    <div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;height:110px;">
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px;height:110px;">商品图片：</span>
                        <div class="photo-box mar-l">
                            <c:forEach items="${imgs}" var="item" varStatus="status">
                                <input id="imageId" type="hidden" value="${item.id}">
                                <div id="delete${item.url}" style="float: left;">
                                    <input id="imgId${status.index+1}" type="hidden" value="${item.url}"> 
                                    <img id="imgPic${item.url}" width="80px" height="80px;" style="float: left; margin-left: 50px; margin-top:10px;" src="${sessionScope.image_logo}${item.url}"> 
                                </div>
                            </c:forEach>
                        </div>
                    </div>
                     <%-- <div class="itemEdit" style="border-bottom: 1px solid #CBD5DD; height:110px;">
                        <span class="col-sm-1 editlableDetail" style="font-size: 14px; height:110px;">商品描述：</span>
                        <div class="fldetail-4r">${goodsInfo.detail}</div>
                    </div> --%>

                    <table id="contentDiv" style="border-left: 1px solid #CBD5DD; border-right: 1px solid #CBD5DD;border-bottom: 1px solid #CBD5DD; border-top: none; width: 100%; height: 200px;" cellspacing="0" cellpadding="0">
                        <tr>
                            <td id="contentSpan"
                                style="color: #504949; font-size: 14px; width: 15.15%; background-color: #EAFBFC; text-align: right; height: 37px; line-height: 37px; vertical-align: text-top;">
                                <span
                                class="col-sm-1 editlableDetail" style="font-size: 14px; width: 80px; margin-left: 78px;">商品描述：</span></td>
                            <td style="text-align: left; width: 100%; min-height: 200px; padding: 8px 20px; vertical-align: text-top;">${goodsInfo.detail}</td>
                        </tr>
                    </table>

                    <!--新增自定义属性  -->
                    <div style="border: 1px solid #CBD5DD; border-top: none; background-color: #fff;">
                        <div class="attr-wrap">
                            <div class="text-box">商品规格</div>
                            <div class="newattr">
                                <table id="attr_spec">
                                    <tr>
                                        <c:forEach items="${attrNames}" var="attrName" varStatus="attrNameStatus">
                                            <td class="bg-td" width="250px">${attrName}<img id='close' src='images/guanbi.png' onclick='delete_cloum(this);'></td>
                                        </c:forEach>
                                        <c:if test="${goodsType == 2}">
                                            <td class="bg-td" width="150px">兑换积分</td>
                                        </c:if>
                                        <c:if test="${goodsType == 3}">
                                            <td class="bg-td" width="150px">秒杀价格</td>
                                        </c:if>
                                        <td class="bg-td" width="150px">库存</td>
                                        <td class="bg-td" width="150px">操作</td>
                                    </tr>
                                    <c:forEach items="${goodsSpecList}" var="specInfo" varStatus="specInfoStatus">
                                        <tr>
                                            <c:forEach items="${specInfo.goodsSpecificationAttrs}" var="attrInfo" varStatus="attrInfoStatus">
                                                <td><input type="text" class="add-input" value="${attrInfo.attrValue}"></td>
                                            </c:forEach>
                                            <c:if test="${goodsType == 2}">
                                                <td><input type="text" name="price" onkeyup="checInputNumOnly(this)" class="add-input" value="${specInfo.price}" /></td>
                                            </c:if>
                                            <c:if test="${goodsType == 3}">
                                                <td><input type="text" name="price" onkeyup="checInputNum(this)" class="add-input" value="${specInfo.price}" /></td>
                                            </c:if>
                                            <td><input type="text" name="stock" onkeyup="checInputNumOnly(this)" class="add-input" value="${specInfo.stock}" /> <input type="hidden" name="specId"
                                                value="${specInfo.id}" /></td>
                                            <td><input type="button" value="删除" onclick="deleteRow(this);" class="delete-btn" /></td>
                                        </tr>
                                    </c:forEach>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <div style="text-align: center;">
                    <button style="margin-top: 20px;" class="buttonCancle" onclick="cancel();">返&nbsp;&nbsp;回</button>
                </div>
            </div>
        </div>
    </div>
    <%@include file="/views/common/footer.jsp"%>
</section>
<script type="text/javascript">
        var ctx = '${ctx}';
        setCtx(ctx);
    </script>
<script type="text/javascript">
//返回上一页
function cancel(){
    var goodsType = $("#type").val();
    loadContent("/goodsInfo/goodsInfoList?goodsType=" + goodsType);
}

</script>
